<?php

use think\migration\Migrator;
use think\migration\db\Column;

class FixDataMovieSettleTimeHander extends Migrator
{
    public function up()
    {
        \app\model\MovieOrder::query()
            ->where('settle_time',0)
            ->where('supplier_status',\app\model\MovieOrder::SUPPLIER_STATUS_SETTLEMENT)
            ->select()->each(function (\app\model\MovieOrder $movieOrder){
                $movieOrder->settle_time = \Carbon\Carbon::parse($movieOrder->created_at)->addHours(10)->timestamp;
                $movieOrder->save();
            });
    }

    public function down()
    {

    }
}
